<%--
  Created by IntelliJ IDEA.
  User: cos
  Date: 2022/6/8
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<button id="btn1">点击</button>
<div id="msg"></div>
<script>
    $(function () {
        $("#btn1").click(function () {
                $.ajax({
                    type:"get",
                    url:"http://localhost:8080/rest/user",
                    success:function (result) {
                        $("#msg").text(result);
                    }
                    ,
                    xhrFields: {
                        // 跨域携带cookie
                        withCredentials: true
                    }
                })
        })
    })
</script>
</body>
</html>
